package com.lb.shopguide.ui.fragment.boss;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import com.lb.shopguide.R;
import com.lb.shopguide.base.BaseCommonFragment;
import com.lb.shopguide.constants.AppConstant;
import com.lb.shopguide.ui.view.ClearTitleBar;
import com.lb.shopguide.ui.view.chart.LbMemberPercentLayout;
import com.lb.shopguide.ui.view.chart.LbShopDataLayout;
import com.lb.shopguide.ui.view.chart.entity.MemberPercentBean;
import com.lb.shopguide.ui.view.chart.entity.ShopDataBean;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * Created by kang on 2018/1/23.
 */

public class FragmentAllShopData extends BaseCommonFragment {
    @BindView(R.id.ctb)
    ClearTitleBar ctb;
    @BindView(R.id.layout_all_shop_data)
    LinearLayout layoutShopData;

    private ArrayList<ShopDataBean> list;



    public static FragmentAllShopData newInstance(ArrayList<ShopDataBean> list) {
        FragmentAllShopData fragmentAllShopData = new FragmentAllShopData();
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList(AppConstant.SHOP_DATA_BEAN_LIST, list);
        fragmentAllShopData.setArguments(bundle);
        return fragmentAllShopData;
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_all_shop_data;
    }

    @Override
    public void initData() {
        Bundle bundle = getArguments();
        if (bundle.containsKey(AppConstant.SHOP_DATA_BEAN_LIST)) {
            list = bundle.getParcelableArrayList(AppConstant.SHOP_DATA_BEAN_LIST);
        }
    }

    @Override
    public void initView() {
        ctb.setTvTitle("门店数据");
        ctb.setLeftImageSrc(R.drawable.iv_back);
        for (int i = 0; i < list.size(); i++) {
            LbShopDataLayout lbShopDataLayout = new LbShopDataLayout(mContext);
            lbShopDataLayout.setShopData(list.get(i), i);
            layoutShopData.addView(lbShopDataLayout);
        }
        ctb.setOnLeftImageListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                pop();
            }
        });
    }

    @Override
    public void finishRefresh() {

    }

    @Override
    public void sessionOutOfDate() {

    }

    @Override
    public void requestError(String error) {

    }

    @Override
    public String getPageTag() {
        return FragmentAllShopData.class.getName();
    }
}
